fix: resolve .NET 8 SDK transitive dependencies from deps.json files#170
Open
alafleur-genetec wants to merge 2 commits intomainfrom
Open
fix: resolve .NET 8 SDK transitive dependencies from deps.json files#170alafleur-genetec wants to merge 2 commits intomainfrom
alafleur-genetec wants to merge 2 commits intomainfrom
Conversation
The SdkResolver previously only used Genetec.Sdk.deps.json to resolve dependencies. Assemblies required by transitive dependencies (e.g., Genetec.Platform.Security) that were not listed in Genetec.Sdk.deps.json and not physically present in the SDK installation folder could not be found, causing authentication failures (ConnectionEstablished → Failed). The resolver now parses all .deps.json files in the SDK folder and builds an index that maps assembly names to file paths, checking the SDK folder first and falling back to the local NuGet package cache.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the .NET 8 sample SDK resolver to resolve assemblies required by transitive dependencies by parsing all .deps.json files in the SDK folder and mapping referenced runtime assemblies to either the SDK folder or the local NuGet cache.
Changes:
- Replace
AssemblyDependencyResolverusage with a.deps.json-driven assembly path index. - Parse all
*.deps.jsonfiles in the SDK probing folder to build a name → path map, with fallback to the user NuGet global-packages cache. - Use the index as the first strategy during
AssemblyLoadContext.Default.Resolving.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove unused System.Runtime.InteropServices import - Reject rooted paths from deps.json to prevent path traversal - Use NUGET_PACKAGES env var before falling back to default cache path - Continue indexing SDK folder DLLs even when NuGet cache is missing - Add null guard on s_packageAssemblyPaths in LoadAssembly - Catch specific exceptions (BadImageFormatException, JsonException, IOException) - Process all targets in deps.json instead of only the first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SdkResolver previously only used Genetec.Sdk.deps.json to resolve dependencies. Assemblies required by transitive dependencies (e.g., Genetec.Platform.Security) that were not listed in Genetec.Sdk.deps.json and not physically present in the SDK installation folder could not be found, causing authentication failures (ConnectionEstablished → Failed).
The resolver now parses all .deps.json files in the SDK folder and builds an index that maps assembly names to file paths, checking the SDK folder first and falling back to the local NuGet package cache.